package main

import (
	"fmt"
	"my/go_draft/study/20180831/model"
)

type Account struct {
	account_id string
	password   string
	balance    float64
}

func (account *Account) Deposite(money float64, password string) {
	if password != account.password {
		fmt.Println("密码不正确")
		return
	}
	if money <= 0 {
		fmt.Println("输入金额不正确")
		return
	}
	account.balance += money
	fmt.Println("存款成功")
}

func (account *Account) withDraw(money float64, password string) {
	if password != account.password {
		fmt.Println("密码不正确")
		return
	}
	if money <= 0 || money > account.balance {
		fmt.Println("输入金额不正确")
		return
	}
	account.balance -= money
	fmt.Println("取款成功")
}

func (account *Account) query(password string) {
	if password != account.password {
		fmt.Println("密码不正确")
		return
	}
	fmt.Printf("余额是%v", account.balance)
}

func main() {
	account := &Account{
		account_id: "ssss",
		password:   "xxxxx",
		balance:    8888.88,
	}
	account.query("xxxxx")
	account.Deposite(1, "xxxxx")
	account.query("xxxxx")

	var Person = model.NewPerson("Ryan")
	fmt.Println(Person)
	var age uint
	fmt.Println("请输入年龄")
	fmt.Scanln(&age)
	Person.SetAge(age)
	fmt.Println(Person.GetAge())
	fmt.Println(Person)
}
